Telegram Group & Telegram Channel
Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из из модуля urllib.



tg-me.com/python_academy/1740
Create:
Last Update:

Упаковка параметров с помощью urlencode

Довольно часто приходится работать с разнообразными API и совершать get-запросы с передачей множества параметров. Чаще всего составление запроса в коде выглядит примерно так:

url = 'https://example.com?item={}&size={}&color={}&amount={}'.format('t-shirt', 'M', 'white', 5)

Смотрится не слишком презентабельно, однако есть слегка более длинный, но значительно улучающий читаемость кода вариант – функция urlencode из из модуля urllib.

BY Python Academy




Share with your friend now:
tg-me.com/python_academy/1740

View MORE
Open in Telegram


Python Academy Telegram | DID YOU KNOW?

Date: |

Newly uncovered hack campaign in Telegram

The campaign, which security firm Check Point has named Rampant Kitten, comprises two main components, one for Windows and the other for Android. Rampant Kitten’s objective is to steal Telegram messages, passwords, and two-factor authentication codes sent by SMS and then also take screenshots and record sounds within earshot of an infected phone, the researchers said in a post published on Friday.

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

Python Academy from ar


Telegram Python Academy
FROM USA